﻿@model Weibo.Web.Models.MbIndexModel
<ul id="feed_list@{@(Model.Buffer == 0 ? "" : Model.Buffer.ToString())}" class="MIB_feed">
    @{
        if (Model.MiniBlogs != null)
        {
            foreach (Weibo.Entity.MiniBlog m in Model.MiniBlogs)
            {
                if (m != null)
                {
                    var dateSpan = DateSpan.Get(m.CreateTime);
                    From from = Froms.GetFromByID(m.FromID);
                    var user = Users.GetUserByID(m.UID);
                    var content = MiniBlogs.BBCodeToHtml(m.RealContent);
                    string[] media = m.MediaContent.Split(',');
                    if (user != null)
                    {
        <li id="mid_@{@m.ID;}" class="MIB_linedot_l">
            <div class="head_pic">
                <a href="/@{@user.ID;}" uid="@{@user.ID;}" namecard="true" uname="@{@user.NickName;}" >
                    <img src="@{@user.MidAvartar;}" 
                                                    title="@{@user.NickName;}" /></a>
            </div>
            <div class="MIB_feed_c">
                <p  mid="@{@m.ID;}" class="sms">
                    <a title="@{@user.NickName;}" href="/@{@user.ID;}" uid="@{@user.ID;}" namecard="true"  uname="@{@user.NickName;}">
                        @{@user.NickName;}
                    </a>：@{@MvcHtmlString.Create(string.IsNullOrEmpty(Model.Key) ? content : HighLineHelper.HighLine(content, Model.Key));}
                </p>
                @{
                                                                                                                                         if (m.IsOriginal == 1 && m.OriginalMID < 0)
                                                                                                                                         {
                    <div id="prev_@{@m.ID;}" class="feed_preview" style="">
                        @{
                                         if (media[0] != "-1")
                                         {

                            <div class="feed_img">
                                <a href="javascript:;" onclick="App.scaleImg(this,'@{@m.ID;}');return false;">
                                    <img  class="imgicon" src="@{@media[4];}" /></a>
                                <img src="/Content/Image/loading.gif" style="position: absolute; background-color: transparent;
                                    border: 0px none; width: 16px; height: 16px; z-index: 1001; display: none;" />
                            </div>
                                         }
                                         if (media[1] != "-1")
                                         {
    
                            <div class="feed_img" type="video" vid="@{@media[1];}" mid="@{@m.ID;}" style="width: 120px; height: 90px;">
                                <a onclick="return false;" href="javascript:void(0);">
                                    <img width="120" height="90" style="cursor: pointer;" class="imgicon"
                                                                    src="@{@media[5];}" /></a><img src="/Content/Image/feedvideoplay.gif" onmouseover="App.mouseoverIco(this);"
                                                                        onmouseout="App.mouseoutIco(this);" style="cursor: pointer; display: block; margin-top: -61.5px;
                                                                        margin-left: 43.5px; opacity: 0.5; filter: alpha(opacity=50);" /></div>
                                                             
                                         }
                                         if (media[2] != "-1")
                                         {
                            <div class="feed_img" type="music" musicid="@{@media[2];}" mid="@{@m.ID;}" style="width: 135px; height: 33px;">
                                <a onclick="return false;" href="javascript:void(0);">
                                    <img style="cursor: pointer;" class="imgicon" src="/Content/Image/music_s.gif" /></a></div>
                                         }
                                         if (media[3] != "-1")
                                         {
                                             if (!string.IsNullOrEmpty(media[6]))
                                             {
                            <div class="feed_img" type="vote" voteid="@{@media[3];}" mid="@{@m.ID;}" >
                                <a onclick="return false;" href="javascript:void(0);">
                                    <img style="cursor: pointer;" class="imgicon" src="@{@media[6];}" /></a><img onmouseover="App.mouseoverIco(this);"
                                        onmouseout="App.mouseoutIco(this);" src="/Content/Image/vote_picicon_01.gif"
                                        style="cursor: pointer; display: none; opacity: 0.5; filter: alpha(opacity=50);"></div>
                                                        
                                             }
                                             else
                                             {
                            <div class="feed_img" type="vote" voteid="@{@media[3];}" mid="@{@m.ID;}" style="width: 120px; height: 90px;">
                                <a onclick="return false;" href="javascript:void(0);">
                                    <img style="cursor: pointer;" class="imgicon" src="/Content/Image/vote_pic_01.gif" /></a></div>
                                             }
                                         }
                        }
                        <div class="clear">
                        </div>
                    </div>
                    <div style="display: none;" id="disp_@{@m.ID;}" class="MIB_assign">
                    </div>
                                                                                                                                         }
                                                                                                                                         else
                                                                                                                                         {
                                                                                                                                             MiniBlog oriMBlog = MiniBlogs.GetMiniBlogByID(m.OriginalMID);
                                                                                                                                             if (oriMBlog != null)
                                                                                                                                             {
                                                                                                                                                 var odateSpan = DateSpan.Get(oriMBlog.CreateTime);
                                                                                                                                                 From ofrom = Froms.GetFromByID(oriMBlog.FromID);

                                                                                                                                                 var ocontent = MiniBlogs.BBCodeToHtml(oriMBlog.RealContent);
                                                                                                                                                 string[] omedia = oriMBlog.MediaContent.Split(',');
                                                                                                                                                 User oriUser = Users.GetUserByID(oriMBlog.UID);
                                                                                                                                                 if (oriUser != null)
                                                                                                                                                 {
                                                                                                     
                    <div class="MIB_assign">
                        <div class="MIB_asarrow_l">
                        </div>
                        <div class="MIB_assign_t">
                        </div>
                        <div class="MIB_assign_c MIB_txtbl">
                            <p  mid="@{@m.ID;}" class="source">
                                <a href="/@{@oriUser.ID;}" uid="@{@oriUser.ID;}" namecard="true" uname="@{@oriUser.NickName;}" >
                                    @@@{@oriUser.NickName;}
                                </a>：@{@MvcHtmlString.Create(string.IsNullOrEmpty(Model.Key) ? ocontent : HighLineHelper.HighLine(ocontent, Model.Key));}
                            </p>
                            <div id="prev_@{@m.ID;}" class="feed_preview" mbind="1" style="">
                                @{
                                                 if (omedia[0] != "-1")
                                                 {

                                    <div class="feed_img">
                                        <a href="javascript:;" onclick="App.scaleImg(this,'@{@m.ID;}');return false;">
                                            <img vimg="1" class="imgicon" src="@{@omedia[4];}" /></a>
                                        <img src="/Content/Image/loading.gif" style="position: absolute; background-color: transparent;
                                            border: 0px none; width: 16px; height: 16px; z-index: 1001; display: none;" />
                                    </div>
                                                 }
                                                 if (omedia[1] != "-1")
                                                 {
                                    <div class="feed_img" type="video" vid="@{@omedia[1];}" mid="@{@m.ID;}" style="width: 120px; height: 90px;">
                                        <a onclick="return false;" href="#">
                                            <img width="120" height="90" style="cursor: pointer;" class="imgicon"
                                                                    src="@{@omedia[5];}" /></a><img src="/Content/Image/feedvideoplay.gif" onmouseover="App.mouseoverIco(this);"
                                                                        onmouseout="App.mouseoutIco(this);" style="cursor: pointer; display: block; margin-top: -61.5px;
                                                                        margin-left: 43.5px; opacity: 0.5; filter: alpha(opacity=50);" /></div>
                                                 }
                                                 if (omedia[2] != "-1")
                                                 {
                                    <div class="feed_img" type="music" musicid="@{@omedia[2];}" mid="@{@m.ID;}" style="width: 135px; height: 33px;">
                                        <a onclick="return false;" href="#">
                                            <img style="cursor: pointer;" class="imgicon" src="/Content/Image/music_s.gif" /></a></div>
                                                 }
                                                 if (omedia[3] != "-1")
                                                 {
                                                     if (!string.IsNullOrEmpty(omedia[6]))
                                                     {
                                    <div class="feed_img" type="vote" voteid="@{@omedia[3];}" mid="@{@m.ID;}" >
                                        <a onclick="return false;" href="#">
                                            <img style="cursor: pointer;" class="imgicon" src="@{@omedia[6];}" /></a><img onmouseover="App.mouseoverIco(this);"
                                                onmouseout="App.mouseoutIco(this);" src="/Content/Image/vote_picicon_01.gif"
                                                style="cursor: pointer; display: none; opacity: 0.5; filter: alpha(opacity=50);"></div>
                                                     }
                                                     else
                                                     {
                                    <div class="feed_img" type="vote" voteid="@{@omedia[3];}" mid="@{@m.ID;}"  style="width: 120px; height: 90px;">
                                        <a onclick="return false;" href="#">
                                            <img style="cursor: pointer;" class="imgicon" src="/Content/Image/vote_pic_01.gif" /></a></div>
                                                     }
                                                 }
                                }
                                <div class="clear">
                                </div>
                            </div>
                            <div style=" display: none;" id="disp_@{@m.ID;}" class="blogPicOri">
                            </div>
                            <div class="feed_att MIB_linkbl MIB_txtbl">
                                <div class="lf">
                                    <cite><a  href="/@{@oriUser.ID;}/@{@oriMBlog.IDCode;}"><strong>
                                        @{@odateSpan;}
                                    </strong></a></cite><strong>来自</strong><cite><a
                                                                            target="_blank" href="@{@ofrom.FromUrl;}">@{@ofrom.FromName;}
                                    </a></cite>
                                </div>
                                <div class="rt">
                                    <a  href="/@{@oriUser.ID;}/@{@oriMBlog.IDCode;}">转发@{
                                                                                 if (oriMBlog.QuoteCount > 0)
                                                                                 {<strong type="rttCount">(@{@oriMBlog.QuoteCount;}
                                                                                     )</strong>
                                                                                 }
                                    }
                                    </a><span class="MIB_line_l">|</span> <a  href="/@{@oriUser.ID;}/@{@oriMBlog.IDCode;}">
                                        评论@{
                                                                                                                       if (oriMBlog.CommentCount > 0)
                                                                                                                       {<strong type="commtCount">(@{@oriMBlog.CommentCount;}
                                                                                                                           )</strong>
                                                                                                                       }
                                        }
                                    </a>
                                </div>
                            </div>
                        </div>
                        <div class="MIB_assign_b">
                        </div>
                    </div>
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                             else
                                                                                                                                             {
                    <div class="MIB_assign">
                        <div class="MIB_asarrow_l">
                        </div>
                        <div class="MIB_assign_t">
                        </div>
                        <div class="MIB_assign_c MIB_txtbl">
                            <p class="source">
                                该微博已被删除</p>
                        </div>
                        <div class="MIB_assign_b">
                        </div>
                    </div>
                                                                                                                                             }
                                                                                                                                         }
                }
                <!-- 转发 -->
                <!-- 转发 -->
                <div class="feed_att MIB_linkbl MIB_txtbl">
                    <div class="lf">
                        <cite><a  href="/@{@user.ID;}/@{@m.IDCode;}"><strong>
                            @{@dateSpan;}
                        </strong></a></cite><strong>来自</strong><cite><a
                                                                 target="_blank" href="@{@from.FromUrl;}">@{@from.FromName;}
                        </a></cite>
                    </div>
                    <div class="rt">
                        <!-- 转发 -->
                        @{
                                                                                                                          if (user.ID == Model.CurUser.ID)
                                                                                                                          {
                            <strong><a onclick="App.miniblogDel('@{@m.ID;}',this)" href="javascript:void(0);"><strong>
                                删除</strong></a><span class="MIB_line_l">|</span></strong>
                                                                                                                          }
                        }
                        <a onclick="App.showFeedDiv('@{@m.ID;}',@{@m.IsOriginal;},'@{@m.OriginalMID;}');return false;"
                                                            href="javascript:void(0);"><strong lang="CD0023">转发</strong>@{
                                                                                                   if (m.QuoteCount > 0)
                                                                                                   {<strong type="rttCount"id="num_@{@m.ID;}">(@{@m.QuoteCount;}
                                                                                                       )</strong>
                                                                                                   }
                                                            }
                        </a>
                        <!-- 转发 -->
                        <span class="MIB_line_l">|</span> <a onclick="App.AddFavorite(@{@Model.CurUser.ID},@{@m.ID;},this);return false;"
                                                            href="javascript:void(0);"><strong lang="CL1003">收藏</strong></a>
                        <!-- 评论 -->
                        <span class="MIB_line_l">|</span> <a onclick="App.InsertCommentBox('@{@m.ID;}','@{@user.ID}')"
                                                            href="javascript:void(0);" id="comment_count_@{@m.ID;}">
                            <strong>评论</strong>@{
                                                                                                                if (m.CommentCount > 0)
                                                                                                                {<strong>(@{@m.CommentCount;}
                                                                                                                    )</strong>
                                                                                                                }
                            }
                        </a>
                        <!-- 评论 -->
                    </div>
                </div>
                <div id="comment_list_@{@m.ID;}">
                </div>
            </div>
        </li>
                    }
                }
            }
        }
    }
</ul>
@if (Model.Buffer == 2 || ((Model.Page - 1) * 3 + Model.Buffer + 1) * Model.PageSize / 3 >= Model.RecordCount)
{
    <div id="page" class="MIB_bobar">
        @Html.Pager(Model.Page, Model.RecordCount, Model.PageSize, true)
    </div>
}
else
{
    <div id="loadMB1" class="feed_lding MIB_txtbl">
        <em class="icon_lding"></em>正在加载，请稍候...</div>

    <div id="loadError1" style="display: none;" class="feed_lding MIB_txtbl">
        <em class="icon_lding"></em>加载失败，<a href="javascript:ajaxGetMiniBlog(null,true);">请重试</a>...</div>

    <div id="loadNoresult1" style="display: none;" class="feed_lding MIB_txtbl">
        <em class="icon_lding"></em>此人很懒...</div>
}
